import * as React from 'react';
import * as PropTypes from 'prop-types';
import { Button, Modal } from 'antd';
import FormInfo from '@/pages/routes/table/FormInfo';
import { Moment } from 'moment';
import { EquTableDataItem } from '@/pages/routes/table/equ-table';

export interface NewPlan$Props {
  // formCollection: (data: DataColletion) => void;
}
interface DataColletion {
  name: string;
  type: number;
  area: number;
  startDate: Moment | undefined;
  endDate: Moment | undefined;
  ts: EquTableDataItem[];
  hf: EquTableDataItem[];
  scdd: string;
  gwyx: string;
  bmzz: EquTableDataItem[];
  mark: string;
}

export interface NewPlan$State {
  visible: boolean;
  dataCollection: DataColletion[];
}

class NewPlan extends React.Component<NewPlan$Props, NewPlan$State> {
  public static propTypes = {};
  public static defaultProps = {};
  public state = {
    visible: false,
    dataCollection: [],
  };
  public newPlan = () => {
    this.setState({ visible: true });
  };
  render() {
    const { dataCollection } = this.state;
    return (
      <div>
        <Button type={'primary'} onClick={this.newPlan}>
          新建方案
        </Button>
        <div>
          <Modal
            title="添加调度方案"
            width={800}
            visible={this.state.visible}
            onOk={this.handleOk}
            onCancel={this.handleCancel}
            footer={null}
          >
            <FormInfo
            // formCollection={(data: DataColletion) => {
            //   this.setState({ dataCollection });
            // }}
            />
          </Modal>
        </div>
      </div>
    );
  }
  private handleOk = () => {
    this.setState({ visible: false });
  };
  private handleCancel = () => {
    this.setState({ visible: false });
  };
}

export default NewPlan;
